# ========================== project settings
set(MY_LIB common)

# =========================== 创建库
add_library(${MY_LIB} SHARED)

set_target_properties(${MY_LIB} PROPERTIES
    LINKER_LANGUAGE "CXX"
    # OUTPUT_NAME ${OUT_NAME}
)

target_sources(${MY_LIB}
    PRIVATE
        MyInitial.cpp
        Args.cpp
    PUBLIC
        MyInitial.h
        MyMacro.h
        MyPrtFns.h
        MyRunTest.h
        MyTypes.h
        proxy.h
        Args.h
        MacrosCuda.h
)

target_include_directories(${MY_LIB}
    PUBLIC
        "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${MY_THIRD_PARTY_HXX}>"
        "$<INSTALL_INTERFACE:include>"
)

#=============================== 链接到 fmt 和 spdlog
target_link_libraries(${MY_LIB}
    PUBLIC
        fmt::fmt
        spdlog::spdlog $<$<BOOL:${MINGW}>:ws2_32>
        argparse::argparse
)

# 设置库属性
# set_target_properties(${MY_LIB} PROPERTIES
#     INTERFACE_INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}"
# )

#============================= 使用自定义函数配置导出头文件
my_config_export_header(${MY_LIB} ${MY_EXPORTS_DIR})

# xxxxxxxxxxxxxxxxxxx 设置 VS 文件夹
set_property(TARGET ${MY_LIB} PROPERTY FOLDER common)
